import request from '@/utils/request';
const basePath = '/appsys/passwordtemplet/AppPasswordTempletRest';
import type { BaseBeanModel, ResponsePageData, ResponseBaseData, QueryParamModel } from '@/api/model/baseModel';

export interface SysPasswordTemplateLevelDto extends BaseBeanModel {
  /** 密码模板名称 */
  key?: string;
  /** 密码模板编码 */
  code?: string;
  /** 用户密级 */
  userLevelCode?: string;
}

/**
 * 获取分页数据
 * @param param QueryParamModel
 * @returns 列表数据
 */
export function listSysPasswordTemplateLevelByPage(
  param: QueryParamModel
): Promise<ResponsePageData<SysPasswordTemplateLevelDto>> {
  return request.post(`${basePath}/search-main-by-page/v1`, param);
}

/**
 * 根据id加载主表数据
 * @param id 选中行数据的id
 * @returns 行数据
 */
export function getSysPasswordTemplateLevel(id: string): Promise<ResponseBaseData<SysPasswordTemplateLevelDto>> {
  return request.get(`${basePath}/get-main/${id}/v1`);
}

/**
 * 保存表单数据
 * @param form SysPasswordTemplateLevelDto
 * @returns 新增数据
 */
export function saveSysPasswordTemplateLevel(form: SysPasswordTemplateLevelDto): Promise<ResponseBaseData<any>> {
  return request.post(`${basePath}/save-main/v1`, form);
}

/**
 * 根据id集合删除数据
 * @param ids 选中数据的id
 * @returns 删除成功或失败的结果
 */
export function delSysPasswordTemplateLevel(ids: [string]): Promise<ResponseBaseData<any>> {
  return request.delete(`${basePath}/delete-main-by-ids/${ids}/v1`);
}
